<?php defined('_JEXEC') or die('Restricted access'); ?>

<?php JHTML::_('behavior.tooltip'); ?>

<?php
	$cid = JRequest::getVar( 'cid', array(0) );//获取页面变量
	$edit		= JRequest::getVar('edit',true);
	$text = intval($edit) ? JText::_( 'Edit' ) : JText::_( 'New' );

	JToolBarHelper::title( JText::_( '系统通知' ) . ': <small><small>[ '. $text .' ]</small></small>' , 'user.png' );
	JToolBarHelper::save();
	JToolBarHelper::apply();
	if ( $edit ) {
		// for existing items the button is renamed `close`
		JToolBarHelper::cancel( 'cancel', 'Close' );
	} else {
		JToolBarHelper::cancel();
	}
	//JToolBarHelper::help( 'screen.users.edit' );
	//$cparams = JComponentHelper::getParams ('com_media');
?>


<script language="javascript" type="text/javascript">
	function submitbutton(pressbutton) {
		var form = document.adminForm;
		if (pressbutton == 'cancel') {
			submitform( pressbutton );
			return;
		}
		var r = new RegExp("[\<|\>|\"|\'|\%|\;|\(|\)|\&]", "i");

		// do field validation
		if (trim(form.to_profile.value) == "") {
			alert( "<?php echo JText::_( '请输入接受消息用户ID', true ); ?>" );
		} else if (form.content.value == "") {
			alert( "<?php echo JText::_( '请输入系统消息内容', true ); ?>" );
		} else if (form.rendered.value == "") {
			alert( "<?php echo JText::_( '请输入系统消息内容(HTML)', true ); ?>" );
		} else {
			submitform( pressbutton );
		}
	}

	function gotocontact( id ) {
		var form = document.adminForm;
		form.contact_id.value = id;
		submitform( 'contact' );
	}
</script>
<form action="index.php" method="post" name="adminForm" autocomplete="off">
	<div class="col width-45">
		<fieldset class="adminform">
		<legend><?php echo JText::_( '系统通知内容' ); ?></legend>
			<table class="admintable" cellspacing="1">
				<tr>
					<td width="150" class="key">
						<label for="to_profile">
							<?php echo JText::_( '接受用户ID' ); ?>
						</label>
					</td>
					<td>
						<input type="text" name="to_profile" id="to_profile" class="inputbox" size="40" value="" />
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="content">
							<?php echo JText::_( '消息内容' ); ?>
						</label>
					</td>
					<td>
						<textarea id="content" rows="7" name="content" cols="50"></textarea>
					</td>
				</tr>
				<tr>
					<td class="key">
						<label for="rendered">
							<?php echo JText::_( '消息内容(HTML)' ); ?>
						</label>
					</td>
					<td>
						<textarea id="rendered" rows="7" name="rendered" cols="50"></textarea>
					</td>
				</tr>
				<tr>
					<td valign="top" class="key">
						<label for="message_type">
							<?php echo JText::_( '消息类型设置' ); ?>
						</label>
					</td>
					<td>
						<?php echo $this->lists['messagetype']; ?>
					</td>
				</tr>
				
				
			</table>
		</fieldset>
	</div>
   
	
	<div class="clr"></div>

	
	<input type="hidden" name="option" value="com_sysnotices" />
	<input type="hidden" name="task" value="" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
